home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 18550 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c,comp.lang.c++
  4. Subject: Re: [Q] Any utility to attack misuse of comment /* */
  5. Date: 21 Apr 1996 07:16:25 -0700
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4ldfvpINNi3r@keats.ugrad.cs.ubc.ca>
  8. References: <4l32et$bhm@sun.rhbnc.ac.uk> <Dq0txr.3px@iquest.net>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <Dq0txr.3px@iquest.net>, Doug Miller <dlmiller@iquest.net> wrote:
  12. >>    My question is, is there any free utility available to attack
  13. >>
  14. >
  15. >Don't know about utilities to detect/correct this, but how about a method to avoid it?
  16.  
  17. How about gcc -Wall... the pre-processor will warn about /* found within a
  18. comment.
  19.  
  20. >When "commenting out" lines from a program, instead of using comments use
  21. >the preprocessor:
  22. >
  23. >#if 0
  24. >    (program lines to be "commented out")
  25. >    . . .
  26. >#endif
  27.  
  28. Here is what Eric S. Raymond's Hacker's Dictionary has to say;
  29.  
  30.     _comment out_ vt.  To surround a section of code with comment
  31.     delimiters or to prefix every line in the section with a comment
  32.     marker; this preventrs it from being compiled or interpreted.
  33.     Often done when the code is redundant or obsolete, but is being
  34.     left in the source to make the intent of the active code
  35.     clearer; also when the code in that section is broken and yuou
  36.     want to bypass it in order to debug some other part of the code.
  37.     Compare _condition out_, usually the preferred technique in
  38.     languages (such as C) that make it possible.
  39.  
  40.     _condition out_ vt.  To prevent a section of code from being
  41.     compiled by surrounding it witha conditional-compilation
  42.     directive whose conditionis always false.  The _canonical_
  43.     examples of this directives are #if 0 (or #ifdef notdef), though
  44.     some find the latter _bletcherous_) and #endif in C.  Compare
  45.     _comment out_.
  46.  
  47.